home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / PROBLEMS / PREEMPTER < prev    next >
Internet Message Format  |  1992-04-14  |  18KB

  1. From cmarshall@acorn.co.uk  Wed Apr 15 03:48:28 1992
  2. Received: from unido.Germany.EU.net by helpdesk.rus.uni-stuttgart.de (5.52/BelWue-1.0SG(subsidiary))
  3.     (for zrzm0111) id AA11509; Wed, 15 Apr 92 03:48:28 MST
  4. Received: from eros.uknet.ac.uk 
  5.     by mail.Germany.EU.net with SMTP (5.65+/UNIDO-2.1.0.b)
  6.     via EUnet for helpdesk.rus.uni-stuttgart.de
  7.     id AA28243; Wed, 15 Apr 92 03:49:54 +0200
  8. Received: from acorn.co.uk by eros.uknet.ac.uk with UUCP 
  9.           id <23398-0@eros.uknet.ac.uk>; Wed, 15 Apr 1992 02:48:15 +0100
  10. Received: from oak.acorn.co.uk by acorn.co.uk (4.1/Am32) id AA29108;
  11.           Tue, 14 Apr 92 10:52:30 BST
  12. Date: Tue, 14 Apr 92 10:52:53 +0100
  13. From: cmarshall@acorn.co.uk (Chris Marshall)
  14. To: zrzm0111
  15. Subject: Re: Wanted: Information about the preempter
  16. Message-Id: <29EAB985@cmarshall>
  17. Status: RO
  18.  
  19.  
  20. In article <1992Apr13.183936.3762@news.uni-stuttgart.de> you wrote:
  21.  
  22. >Hi
  23. >
  24. >A few weeks ago, someone told here, that he wrote a tool for preemptive
  25. >multitasking and will public it in comp.binaries.acorn.
  26. >Unfortunatly comp.binaries.acorn is closed for a while. Could someone 
  27. >give me informations about the author ?
  28.  
  29. It's included here...
  30.  
  31. >thanks
  32. >so long
  33. >MUFTI
  34. >
  35. >ps:
  36. >    Shouldn't the moderator of comp.binaries.acorn lay a forward to 
  37. >    one of the ftp/mail-servers, if he isn't on duty for a long time ?
  38. >    The software he gets is not for private Acorn ltd. use .....
  39.  
  40. We could forward all stuff to Albert at Newcastle. The reasons that 
  41. nothing has been posted for a while are as follows:-
  42.  
  43.         a) Phil Colmer is ill at present; he would normally handle
  44.            comp.sources.acorn
  45.  
  46.         b) Alan Glover and myself are v. busy right now. I expect to
  47.            begin posting things again soon, maybe withing the next week
  48.            or two. As for Alan, I don't know. Unfortunately, moderating
  49.            comp.*.acorn isn't really seen as part as the 'job' that we
  50.            do here, so it has to be a spare time activity. 
  51.  
  52. Chris.
  53.  
  54. ______________________________________________________________________
  55. Chris Marshall                                   cmarshall@acorn.co.uk
  56.  
  57. >From pc123@phx.cam.ac.uk Tue Feb 25 19:29:59 1992
  58. Received: by oak.acorn.co.uk (4.1/Ai1.6)
  59.     id AA11229; Tue, 25 Feb 92 19:29:56 GMT
  60. Received: by acorn.co.uk (4.1/Am32)
  61.     id AA13477; Tue, 25 Feb 92 19:29:02 GMT
  62. Received: from phx.cam.ac.uk by eros.uknet.ac.uk via JANET with NIFTP (PP) 
  63.           id <25975-0@eros.uknet.ac.uk>; Tue, 25 Feb 1992 18:22:59 +0000
  64. Date: Tue, 25 Feb 92 18:22:08 GMT
  65. >From: Pete <pc123@phx.cam.ac.uk>
  66. To: submit@acorn.co.uk
  67. Subject: Code for pre-empting a non-desktop task
  68. Message-Id: <A54D6B55FDE90040@UK.AC.CAMBRIDGE.PHOENIX>
  69.  
  70. Newsgroups: comp.sources.acorn
  71.  
  72. Here is the code to demonstrate how you can pre-empt a non-desktop program
  73. without running it in a taskwindow or under FrontEnd, as I promised on c-s-a
  74. recently.  The code implements a module which acts a bit like FrontEnd but is a
  75. tinsy bit more efficient in its use of RMA; it should be possible to convert it
  76. for multitasking raytracers or other code you are writing without too much
  77. difficulty.
  78.  
  79. The module writes all output generated by the program into a circular buffer at
  80. a fixed offset in its workspace - a desktop task then uses the OS_Module call
  81. to find out where the workspace is, and reads data out.  The effect is that
  82. text produced by a program is not stored in the RMA, so excessive fragmentation
  83. does not occur.  This also implies that this module is only the "business end"
  84. of a complete FrontEnd replacement, and you have to write a desktop client
  85. program as well, to display output produced by a task in a window.  I am not
  86. posting the client here, because this source is really for illustration only.
  87.  
  88. The module also allows the task it is running to be stopped and restarted under
  89. control of the controlling program.  This is accomplished by writing various
  90. values into another word at a fixed offset in the module's workspace.
  91. Similarly the module may be asked to kill the program it is pre-empting (never
  92. scheduling it again, and closing all its files) or terminate it (call its exit
  93. handler).
  94.  
  95. As I wrote Express Assembler, the module is written in Express format.  You
  96. shouldn't have too much trouble understanding it, as it does not use any fancy
  97. features.
  98.  
  99. It is well known that only Quiche Eaters comment their programs well.  I have
  100. added a few, but...
  101.  
  102. ...if you find you need help following it, send me mail and I will do my best
  103. to help.  Or flame about it on c-s-a instead  :-)  .
  104.  
  105.  
  106.         SETTYPE "MODULE"
  107.         OBJECT "!YAMU.Initiator"
  108.         ORG 0
  109.         ASSUME PC,0
  110.         ASSUME R12,&10000000
  111.  
  112.         SET VSTR,"1.00"
  113.  
  114.         DD LANGUAGE,0,0,SERVICE,TITLE,HELP,0,0,0,0,0
  115.  
  116. TITLE   DB "Initiator",0
  117.         ALIGN
  118.  
  119. HELP    DB "Initiator",9,"`VSTR` (",OSVAR "Sys$Date" RIGHT 6," ",OSVAR "Sys$Year",")",0
  120.         ALIGN
  121.  
  122. TASKDESC
  123.         DB "Init",0
  124.         ALIGN
  125.  
  126. LANGUAGE
  127.         LOCALS
  128.         MOV R11,R0
  129.  
  130.         ; Claim memory
  131.  
  132.         MOV R0,#6
  133.         LIT R3,WEND-WSTART
  134.         SWI "OS_Module"
  135.         STR R2,[R12]
  136.         STR R12,[R2]
  137.         MOV R12,R2
  138.  
  139.         ; Initialise variables
  140.  
  141.         MOV R0,#0
  142.         ST R0,MEMORYMAPVETOED
  143.         ST R0,OUTBUFFERREAD
  144.         ST R0,OUTBUFFERWRITE
  145.         ST R0,MESSAGES
  146.         ST R0,SUSPENDED
  147.         ST R0,TERMINATING
  148.         ST R0,HANDLESUSED
  149.  
  150.         ; Register as Wimp task
  151.  
  152.         MOV R0,#200
  153.         LIT R1,&4B534154
  154.         ADR R2,TASKDESC
  155.         SWI "Wimp_Initialise"
  156.         ST R1,TASKHANDLE
  157.  
  158.         ; Calculate appropriate (initial) slot size.  This is not calculated
  159.         ; in any special way, it just tries to allocate a reasonable amount
  160.         ; of space.  The newer applications ask the Wimp for more space if
  161.         ; they run out.
  162.  
  163.         MVN R0,#0
  164.         MVN R1,#0
  165.         SWI "Wimp_SlotSize"
  166.         ADD R0,R0,R1
  167.         ADD R0,R0,R2
  168.         CMP R0,#512*1024
  169.         MOVGE R0,#512*1024
  170.         SUBLT R0,R0,#64*1024
  171.         CMP R0,#0
  172.         MOVLE R0,#16*1024
  173.         MVN R1,#0
  174.         SWI "Wimp_SlotSize"
  175.  
  176.         ; Initialise environment, so that funny things don't happen when the
  177.         ; background task calls the exit handler, etc.  In fact the exit
  178.         ; handler has to come back into this code in order for us to tidy up.
  179.  
  180.         MOV R0,#6 ; Error handler
  181.         ADR R1,ERRORHANDLER
  182.         MOV R2,R12
  183.         ADR R3,ERRORBUFFER
  184.         SWI "OS_ChangeEnvironment"
  185.         ADR R0,OLDERRORHANDLER
  186.         STMIA R0,{R1-R3}
  187.  
  188.         MOV R0,#11 ; Exit handler
  189.         ADR R1,EXITHANDLER
  190.         MOV R2,R12
  191.         MOV R3,#0
  192.         SWI "OS_ChangeEnvironment"
  193.         ADR R0,OLDEXITHANDLER
  194.         STMIA R0,{R1-R3}
  195.  
  196.         ; Set interruption of background task
  197.  
  198.         BL SETCALLAFTER
  199.         BL CLAIMVECS
  200.  
  201.         ; And start the task off
  202.  
  203.         MOV R0,R11
  204.         SWI "OS_Write0"         ; This just writes the name of the command
  205.         SWI "OS_NewLine"        ; run into the output buffer.
  206.         MOV R0,R11
  207.         SWI "OS_CLI"            ; Execute the * command that runs the task.
  208.  
  209.         ; This may return, if no application is started.  In this case, there
  210.         ; is an outstanding ticker event to cancel, but apart from that we
  211.         ; just exit.
  212.  
  213.         ADR R13,USRSTACK
  214.         BL CANCELTICKER         ; Cancel the descheduling time-out.
  215.         BL RELEASEVECS          ; Release vectors we have claimed.
  216.         B KILLMODULE
  217.  
  218. MAINLOOP
  219.         BL RELEASEVECS          ; Must release all vectors before polling.
  220. A
  221.         MOV R0,#0
  222.         ADR R1,POLLBLOCK
  223.         SWI "Wimp_Poll"
  224.         TEQ R0,#0
  225.         BLNE NONIDLEPOLL
  226.         ADR R13,USRSTACK
  227.         BL RECEIVEMESSAGES
  228.         BNE A
  229.  
  230.         ; See whether the output buffer is empty - if not we wait until it
  231.         ; has been emptied before running the task again.
  232.  
  233.         LD R0,OUTBUFFERREAD
  234.         LD R1,OUTBUFFERWRITE
  235.         TEQ R0,R1
  236.         BNE A
  237.  
  238.         ; If the task has been stopped by the controlling task, don't
  239.         ; reschedule it.
  240.  
  241.         LD R0,SUSPENDED
  242.         TEQ R0,#0
  243.         BNE A
  244.  
  245.         ; Set up conditions for re-entering task
  246.  
  247.         BL SETCALLAFTER         ; Create a new CallAfter event
  248.         BL CLAIMVECS            ; and claim the vectors again.
  249.  
  250.         ; If the task is being terminated, get ready to call OS_Exit
  251.  
  252.         LD R0,TERMINATING
  253.         TEQ R0,#0
  254.         MOV R0,#0
  255.         ST R0,TERMINATING
  256.  
  257.         ; Back into the task again.  When restoring the registers, note that
  258.         ; the correct method for doing this is very dependent on the current
  259.         ; processor mode - what is shown is NOT a general way of restoring
  260.         ; a register dump after an exception.
  261.  
  262.         ADR R0,REGBUF
  263.         LDMEQIA R0,{R0-PC}^     ; Restore the task's registers.
  264.         LDMIA R0,{R0-R14}
  265.         MOV R0,#0
  266.         LIT R1,&58454241
  267.         MOV R2,#2
  268.         SWI "OS_Exit"           ; Task is being terminated.  Note how we can
  269.                             ; even call OS_Exit "within" a CallBack handler.
  270.  
  271.         ; General rubbish to do with being a Wimp task, nothing amazing here.
  272.  
  273. NONIDLEPOLL
  274.         TEQ R0,#17
  275.         TEQNE R0,#18
  276.         MOVNES PC,R14
  277.         LD R0,POLLBLOCK+16
  278.         TEQ R0,#0 ; Message_Quit
  279.         MOVNES PC,R14
  280.         ADR R13,USRSTACK
  281.         BL CANCELTICKER
  282.         MOV R0,#0
  283.         ST R0,OUTBUFFERREAD
  284.         ST R0,OUTBUFFERWRITE
  285.  
  286.         ; and continue into KILLMODULE, below.
  287.  
  288.         ; Code to kill the module off.  Nothing here that you don't get in
  289.         ; other modules, the only point worthy of note is that we hang around
  290.         ; in this routine until all the characters have been read out of the
  291.         ; circular buffer.
  292.  
  293. KILLMODULE
  294.         LOCALS
  295.  
  296.         ; Restore environment
  297.  
  298.         MOV R0,#6 ; Error handler
  299.         ADR R1,OLDERRORHANDLER
  300.         LDMIA R1,{R1-R3}
  301.         SWI "OS_ChangeEnvironment"
  302.  
  303.         MOV R0,#11 ; Exit handler
  304.         ADR R1,OLDEXITHANDLER
  305.         LDMIA R1,{R1-R3}
  306.         SWI "OS_ChangeEnvironment"
  307.  
  308.         ; Write the return code into the message word, for the foreground
  309.         ; task
  310.  
  311.         LD R0,RETURNCODE
  312.         ORR R0,R0,#&80000000
  313.         ST R0,MESSAGES
  314.  
  315.         ; Now call Wimp_Poll until all the characters have been removed from
  316.         ; the buffer and the return code has been read
  317.  
  318. A
  319.         MOV R0,#0
  320.         ADR R1,POLLBLOCK
  321.         SWI "Wimp_Poll"
  322.         LD R0,OUTBUFFERREAD
  323.         LD R1,OUTBUFFERWRITE
  324.         TEQ R0,R1
  325.         BNE A
  326.         LD R0,MESSAGES
  327.         TEQ R0,#0
  328.         BNE A
  329.  
  330.         ; Finish off as a Wimp task
  331.  
  332.         LD R0,TASKHANDLE
  333.         LIT R1,&4B534154
  334.         SWI "Wimp_CloseDown"
  335.  
  336.         ; Release workspace
  337.  
  338.         MOV R0,#7
  339.         MOV R2,R12
  340.         SWI "OS_Module"
  341.  
  342.         ; Zero private word so RISC OS doesn't free it again!!
  343.  
  344.         LD R0,PRIVATEWORD
  345.         MOV R1,#0
  346.         STR R1,[R0]
  347.  
  348.         ; ExitAndDie to end program and kill module; don't set return code
  349.         ; as this was set by foreground task.
  350.  
  351.         MOV R0,#0
  352.         MOV R1,#0
  353.         MOV R2,#0
  354.         ADR R3,TITLE
  355.         SWI "OS_ExitAndDie"
  356.  
  357.         ; Just a standard service call handler.  Traps Service_Memory so we
  358.         ; get to keep the memory that the pre-empted task will run in!
  359.  
  360. SERVICE
  361.         ; Nothing to do here except veto attempts by the Wimp to remove all
  362.         ; our memory - this is tried once at the start.
  363.  
  364.         TEQ R1,#&11 ; Service_Memory
  365.         MOVNES PC,R14
  366.         STMFD R13!,{R0,R12,R14}
  367.         LDR R12,[R12]
  368.         LD R0,MEMORYMAPVETOED
  369.         TEQ R0,#0
  370.         LDMNEFD R13!,{R0,R12,PC}^
  371.         MOV R1,#0
  372.         MOV R0,#1
  373.         ST R0,MEMORYMAPVETOED
  374.         LDMFD R13!,{R0,R12,PC}^
  375.  
  376.         ; Claim write character (so we redirect the program's output into
  377.         ; the circular buffer) and open file (so we know what files the
  378.         ; program has open, so we can close them again if it is killed).
  379.  
  380. CLAIMVECS
  381.         MOV R0,#3 ; WrchV
  382.         ADR R1,WRCHV
  383.         MOV R2,R12
  384.         SWI "OS_Claim"
  385.  
  386.         MOV R0,#&D ; FindV
  387.         ADR R1,FINDV
  388.         MOV R2,R12
  389.         SWI "OS_Claim"
  390.  
  391.         MOVS PC,R14
  392.  
  393. RELEASEVECS
  394.         MOV R0,#3 ; WrchV
  395.         ADR R1,WRCHV
  396.         MOV R2,R12
  397.         SWI "OS_Release"
  398.  
  399.         MOV R0,#&D ; FindV
  400.         ADR R1,FINDV
  401.         MOV R2,R12
  402.         SWI "OS_Release"
  403.  
  404.         MOVS PC,R14
  405.  
  406.         ; Schedule a descheduling event.
  407.  
  408. SETCALLAFTER
  409.         MOV R0,#20
  410.         ADR R1,INTERRUPT
  411.         MOV R2,R12
  412.         SWI "OS_CallAfter"
  413.         MOVS PC,R14
  414.  
  415. CANCELTICKER
  416.         STMFD R13!,{R0,R1,R14}
  417.         ADR R0,INTERRUPT
  418.         MOV R1,R12
  419.         SWI "OS_RemoveTickerEvent"
  420.         LDMFD R13!,{R0,R1,PC}^
  421.  
  422. WRCHV
  423.         STMFD R13!,{R1-R2}
  424.         LD R1,OUTBUFFERREAD
  425.         LD R2,OUTBUFFERWRITE
  426.         ADD R2,R2,#2
  427.         BIC R2,R2,#&400
  428.         TEQ R1,R2
  429.         BLEQ CANCELTICKER
  430.         BLEQ SETCALLBACK
  431.         LD R1,OUTBUFFERWRITE
  432.         ADR R2,OUTBUFFER
  433.         STRB R0,[R1,R2]
  434.         ADD R1,R1,#1
  435.         BIC R1,R1,#&400
  436.         ST R1,OUTBUFFERWRITE
  437.         LDMFD R13!,{R1-R2}
  438.         LDMFD R13!,{PC}^
  439.  
  440. FINDV
  441.         LOCALS
  442.         TEQ R0,#0 ; Closing a file
  443.         BEQ A
  444.         STMFD R13!,{R12}
  445.         STMFD R13!,{PC}
  446.         MOVS PC,R14
  447.         MOV R0,R0 ; Our code is re-entered a word further down, so we waste
  448.                   ; this word.
  449.         LDMFD R13!,{R12}
  450.         LDMVSFD R13!,{PC}
  451.         STMFD R13!,{R2,R3}
  452.         ADR R2,HANDLES
  453.         LD R3,HANDLESUSED
  454.         TEQ R3,#32
  455.         MOVEQ R3,#31
  456.         STR R0,[R2,R3,LSL #2]
  457.         ADD R3,R3,#1
  458.         ST R3,HANDLESUSED
  459.         LDMFD R13!,{R2,R3}
  460.         LDMFD R13!,{PC}^
  461. A
  462.         TEQ R1,#0 ; Closing all files
  463.         BEQ B
  464.         STMFD R13!,{R2,R8,R9,R14}
  465.         LD R8,HANDLESUSED
  466.         ADR R9,HANDLES
  467. C
  468.         TEQ R8,#0
  469.         LDMEQFD R13!,{R2,R8,R9,PC}^
  470.         LDR R2,[R9],#4
  471.         SUB R8,R8,#1
  472.         TEQ R1,R2
  473.         BNE C
  474.         MOV R2,#0
  475.         STR R2,[R9,#-4]
  476.         LDMFD R13!,{R2,R8,R9,PC}^
  477. B
  478.         STMFD R13!,{R0,R14}
  479.         MOV R0,#0
  480.         ST R0,HANDLESUSED
  481.         LDMFD R13!,{R0,PC}^
  482.  
  483. INTERRUPT
  484.         ; Remember that we must not corrupt R14svc, so we have to mess about
  485.         ; with changing processor mode.
  486.  
  487.         STMFD R13!,{R0,R14}     ; R14irq goes onto irq stack.
  488.         MOVS R0,PC              ; Preserve old processor mode.
  489.         TEQP PC,#3
  490.         MOV R0,R0
  491.         STMFD R13!,{R14}
  492.         BL SETCALLBACK          ; Use CallBack code.
  493.         LDMFD R13!,{R14}
  494.         TEQP R0,#0
  495.         MOV R0,R0
  496.         LDMFD R13!,{R0,PC}^
  497.  
  498.         ; The following is just standard CallBack code, it restores the
  499.         ; handler address to its old value before returning to the main
  500.         ; program loop.
  501.  
  502. SETCALLBACK
  503.         STMFD R13!,{R0-R3,R14}
  504.         MOV R0,#7               ; CallBack
  505.         ADR R1,CALLBACKHANDLER
  506.         MOV R2,R12
  507.         ADR R3,REGBUF
  508.         SWI "OS_ChangeEnvironment"
  509.         ADR R14,OLDCALLBACK
  510.         STMIA R14,{R1-R3}
  511.         SWI "OS_SetCallBack"
  512.         LDMFD R13!,{R0-R3,PC}^
  513.  
  514. CALLBACKHANDLER
  515.         TEQP PC,#0
  516.         MOV R0,R0
  517.         MOV R0,#7
  518.         ADR R1,OLDCALLBACK
  519.         LDMIA R1,{R1-R3}
  520.         SWI "OS_ChangeEnvironment"
  521.         B MAINLOOP
  522.  
  523.         ; If we get an error reported, we write it into the circular buffer
  524.         ; and kill the program.
  525.  
  526. ERRORHANDLER
  527.         MOV R12,R0
  528.         MOV R0,#2
  529.         ST R0,RETURNCODE
  530.         SWI "OS_NewLine"
  531.         ADR R0,ERRORBUFFER+8
  532.         SWI "OS_Write0"
  533.         SWI "OS_NewLine"
  534.         ADR R13,USRSTACK
  535.         BL CANCELTICKER
  536.         BL RELEASEVECS
  537.         B KILLMODULE
  538.  
  539.         ; If the program exits, we tidy up.
  540.  
  541. EXITHANDLER
  542.         ST R2,RETURNCODE
  543.         ADR R13,USRSTACK
  544.         BL CANCELTICKER
  545.         BL RELEASEVECS
  546.         B KILLMODULE
  547.  
  548.         ; These messages control the pre-empted task.  They allow the
  549.         ; controlling process to stop and restart it, terminate it (which
  550.         ; invokes the program's exit handler) and kill it (which will never
  551.         ; reschedule it, and just closes all its files before shutting down).
  552.  
  553. RECEIVEMESSAGES
  554.         LOCALS
  555.         STMFD R13!,{R0,R14}
  556.         LD R0,MESSAGES
  557.         STMFD R13!,{R0}
  558.         TST R0,#&80000000
  559.         MOVEQ R0,#0
  560.         ST R0,MESSAGES
  561.         LDMFD R13!,{R0}
  562.         TEQ R0,#1 ; Suspend
  563.         BEQ A
  564.         TEQ R0,#2 ; Restart
  565.         BEQ B
  566.         TEQ R0,#3 ; Terminate
  567.         BEQ C
  568.         TEQ R0,#4 ; Kill
  569.         BEQ D
  570.         LDMFD R13!,{R0,PC}^
  571. A
  572.         MOV R0,#1
  573.         ST R0,SUSPENDED
  574.         LDMFD R13!,{R0,PC}^
  575. B
  576.         MOV R0,#0
  577.         ST R0,SUSPENDED
  578.         LDMFD R13!,{R0,PC}^
  579. C
  580.         MOV R0,#1
  581.         ST R0,TERMINATING
  582.         LDMFD R13!,{R0,PC}^
  583. D
  584.         MOV R9,#0
  585.         LD R10,HANDLESUSED
  586.         ADR R11,HANDLES
  587. E
  588.         TEQ R10,#0
  589.         BEQ F
  590.         MOV R0,#0
  591.         LDR R1,[R11],#4
  592.         TEQ R1,#0
  593.         ADDNE R9,R9,#1
  594.         SWINE "OS_Find"
  595.         SUB R10,R10,#1
  596.         B E
  597. F
  598.         BL CLAIMVECS
  599.         SWI "OS_WriteS"
  600.         DB 13,10,10,"Killed",13,10,0
  601.         ALIGN
  602.         MOV R0,R9
  603.         ADR R1,ERRORBUFFER
  604.         MOV R2,#16
  605.         SWI "OS_ConvertCardinal4"
  606.         SWI "OS_Write0"
  607.         SWI "OS_WriteS"
  608.         DB " file(s) closed",13,10,0
  609.         ALIGN
  610.         BL RELEASEVECS
  611.         MOV R0,#2
  612.         ST R0,RETURNCODE
  613.         B KILLMODULE
  614.  
  615.         DSECT
  616.         ORG &10000000
  617. WSTART
  618.  
  619.  
  620. PRIVATEWORD     ALLOC 4
  621. MESSAGES        ALLOC 4         ; Messages are written here by a controlling
  622.                                 ; task.
  623. OUTBUFFERREAD   ALLOC 4
  624. OUTBUFFERWRITE  ALLOC 4
  625. OUTBUFFER       ALLOC 1024      ; The output circular buffer
  626. TASKHANDLE      ALLOC 4
  627. MEMORYMAPVETOED ALLOC 4
  628. SUSPENDED       ALLOC 4
  629. TERMINATING     ALLOC 4
  630. HANDLESUSED     ALLOC 4
  631. RETURNCODE      ALLOC 4
  632. REGBUF          ALLOC 4*16
  633. OLDCALLBACK     ALLOC 4*3
  634. OLDERRORHANDLER ALLOC 4*3
  635. OLDEXITHANDLER  ALLOC 4*3
  636. HANDLES         ALLOC 4*32
  637. POLLBLOCK       ALLOC 256
  638. ERRORBUFFER     ALLOC 256+4+4
  639.  
  640.                 ALLOC 64
  641. USRSTACK
  642.  
  643.  
  644. WEND
  645.         DEND
  646.  
  647.         END
  648.  
  649.